package com.ymh.fegin;

import com.ymh.domain.AccountDTO;
import com.ymh.common.domain.ResultData;
import java.math.BigDecimal;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author: 13590
 * @date: 2020/10/27 19:51
 * @description:
 */
@FeignClient("account-service")
public interface AccountFeign {

  @PostMapping("/insert")
  ResultData<String> insert(@RequestBody AccountDTO accountDTO);

  @DeleteMapping("/delete")
  ResultData<String> delete(@RequestParam("accountCode") String accountCode);

  @PostMapping("/update")
  ResultData<String> update(@RequestBody AccountDTO accountDTO);

  @GetMapping("/accountCode/{accountCode}")
  ResultData<AccountDTO> getByAccountCode(@PathVariable(value = "accountCode") String accountCode);

  @GetMapping("/reduce")
  ResultData<String> reduce(@RequestParam("accountCode") String accountCode, @RequestParam("amount") BigDecimal amount);

}
